package com.xbongbong.paas.service;

import com.xbongbong.paas.pojo.dto.ReportTargetEnableDTO;
import com.xbongbong.paas.pojo.vo.ReportTargetVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.paas.toolbox.wrap.BaseVO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigAddBatchDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigAddDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigEnableDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigFindDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigGetFiscalDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigGetJxcConfigDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigGetPerformanceFinishDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigGetPerformanceLeaveDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigGetWorkingDayMonthDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigGetWorkingDayWeekDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigHasBeenEnableBatchDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigHasBeenEnableDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigHasBeenSetDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigRaidersWhiteDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigSetFiscalDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigSetPerformanceFinishDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigSetWorkingDayMonthDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigSetWorkingDayWeekDTO;
import com.xbongbong.pro.companyconfig.pojo.dto.CompanyConfigSetWorkrecordDTO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigAddBatchVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigEnableVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigFindVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigGetFiscalVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigGetPerformanceFinishVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigGetPerformanceLeaveVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigGetWorkingDayMonthVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigGetWorkingDayWeekVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigHasBeenEnableBatchVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigHasBeenEnableVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigHasBeenSetVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigJxcConfigVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigRaidersWhiteVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigSetFiscalVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigSetPerformanceFinishVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigSetWorkingDayMonthVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigSetWorkingDayWeekVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigSetWorkrecordVO;
import com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigValueSetWorkrecordVO;
import com.xbongbong.pro.companyconfig.pojo.vo.JXCSetListVO;
import com.xbongbong.pro.form.pojo.dto.CustomerCheckRepeatRuleGetDTO;
import com.xbongbong.pro.form.pojo.vo.CustomerCheckRepeatRuleGetVO;
import com.xbongbong.pro.form.pojo.vo.CustomerCheckSetConfigGetVO;
import com.xbongbong.pro.script.pojo.dto.BlacklistBigDataCorpDTO;
import com.xbongbong.pro.script.pojo.vo.ScriptVO;
import com.xbongbong.sys.domain.entity.CompanyConfigEntity;

import java.util.List;

/**
 * @description: 公司配置
 * @Author: hongxiao
 * @date: 2019-01-21 16:12
 */
public interface CompanyConfigService {
    /**
     * 启用/关闭公司配置(开关级配置)
     *
     * @param companyConfigEnableDTO
     * @return
     * @throws XbbException
     */
    CompanyConfigEnableVO enable(CompanyConfigEnableDTO companyConfigEnableDTO) throws XbbException;

    /**
     * 获取公司财年
     *
     * @param companyConfigGetFiscalDTO 入参
     * @return CompanyConfigGetFiscalVO
     * @throws XbbException
     * @author hongxiao
     * @date: 2019-02-17 16:37
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigGetFiscalVO getFiscal(CompanyConfigGetFiscalDTO companyConfigGetFiscalDTO) throws XbbException;

    /**
     * 设置公司财年
     *
     * @param companyConfigSetFiscalDTO
     * @return CompanyConfigSetFiscalVO
     * @throws XbbException
     * @author hongxiao
     * @date: 2019-02-17 17:06
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigSetFiscalVO setFiscal(CompanyConfigSetFiscalDTO companyConfigSetFiscalDTO) throws XbbException;

    /**
     * 获取每月工作日天数
     *
     * @param companyConfigGetWorkingDayMonthDTO 入参
     * @return
     * @throws
     * @author hongxiao
     * @date: 2019-02-17 19:50
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigGetWorkingDayMonthVO getWorkingDayMonth(CompanyConfigGetWorkingDayMonthDTO companyConfigGetWorkingDayMonthDTO) throws XbbException;

    /**
     * 设置每月工作日天数
     *
     * @param companyConfigSetWorkingDayMonthDTO 入参
     * @return
     * @throws
     * @author hongxiao
     * @date: 2019-02-17 19:50
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigSetWorkingDayMonthVO setWorkingDayMonth(CompanyConfigSetWorkingDayMonthDTO companyConfigSetWorkingDayMonthDTO) throws XbbException;

    /**
     * 获取每周工作日天数
     *
     * @param companyConfigGetWorkingDayWeekDTO 入参
     * @return
     * @throws
     * @author hongxiao
     * @date: 2019-02-17 19:50
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigGetWorkingDayWeekVO getWorkingDayWeek(CompanyConfigGetWorkingDayWeekDTO companyConfigGetWorkingDayWeekDTO) throws XbbException;

    /**
     * 设置每周工作日天数
     *
     * @param companyConfigSetWorkingDayWeekDTO 入参
     * @return
     * @throws
     * @author hongxiao
     * @date: 2019-02-17 19:50
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigSetWorkingDayWeekVO setWorkingDayWeek(CompanyConfigSetWorkingDayWeekDTO companyConfigSetWorkingDayWeekDTO) throws XbbException;

    /**
     * 获取Web端完成情况中完成率颜色标识
     *
     * @param companyConfigGetPerformanceFinishDTO 入参
     * @return
     * @throws
     * @author hongxiao
     * @date: 2019-02-17 19:50
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigGetPerformanceFinishVO getPerformanceFinish(CompanyConfigGetPerformanceFinishDTO companyConfigGetPerformanceFinishDTO) throws XbbException;

    /**
     * 设置Web端完成情况中完成率颜色标识
     *
     * @param companyConfigSetPerformanceFinishDTO 入参
     * @return
     * @throws
     * @author hongxiao
     * @date: 2019-02-17 19:50
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigSetPerformanceFinishVO setPerformanceFinish(CompanyConfigSetPerformanceFinishDTO companyConfigSetPerformanceFinishDTO) throws XbbException;

    /**
     * 获取某个规则是否已经存在
     *
     * @param hasBeenSetDTO 入参
     * @return
     * @throws
     * @author hongxiao
     * @date: 2019-02-17 22:01
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigHasBeenSetVO hasBeenSet(CompanyConfigHasBeenSetDTO hasBeenSetDTO) throws XbbException;

    /**
     * 获取规则是否启用
     *
     * @param hasBeenEnableDTO 入参
     * @return
     * @throws
     * @author hongxiao
     * @date: 2019-02-17 22:01
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigHasBeenEnableVO hasBeenEnable(CompanyConfigHasBeenEnableDTO hasBeenEnableDTO) throws XbbException;

    /**
     * 批量获取规则是否启用
     *
     * @param hasBeenEnableBatchDTO 入参
     * @return
     * @throws
     * @author hongxiao
     * @date: 2019-02-17 22:02
     * @version v1.0
     * @since v1.0
     */
    CompanyConfigHasBeenEnableBatchVO hasBeenEnableBatch(CompanyConfigHasBeenEnableBatchDTO hasBeenEnableBatchDTO) throws XbbException;

    /**
     * 获取 跟进记录 是否在拨号后自动添加跟进记录
     *
     * @param corpid 公司id
     * @return
     * @throws XbbException
     */
    boolean isVisitAutoAfterCallCheck(String corpid) throws XbbException;

    /**
     * 通过CompanyConfig表的configValue值来获取启用的指标枚举：按照模块归类
     *
     * @param baseDTO
     * @return
     * @throws XbbException
     */
    ReportTargetVO getReportTarget(BaseDTO baseDTO) throws XbbException;

    /**
     * 获取配置，数据库没有(说明公司还未设置)，则初始化(插入一条默认配置)
     *
     * @param corpid
     * @param configAlias 通过枚举获取 比如 CompanyConfigEnum.PERFORMANCE_SET.getAlias()，CompanyConfigEnum.PERFORMANCE_TYPES.getAlias()
     * @param name
     * @param configValue 配置默认值，比如“移动端设置个人业绩目标权限”默认启用、“目标配置”默认启用全部指标
     * @return
     * @throws XbbException
     * @author chuanpeng.zhang
     */
    CompanyConfigEntity initConfigEntity(String corpid, String configAlias, String name, String configValue) throws XbbException;

    /**
     * 开启关闭单个指标设置
     *
     * @param reportTargetEnableDTO
     * @return
     * @throws XbbException
     */
    BaseVO enableReportTarget(ReportTargetEnableDTO reportTargetEnableDTO) throws XbbException;

    /**
     * 批量保存和更新
     * @author wufeng
     * @date 2019/1/10 9:48
     * @param userConfigAddBatchDTO
     * @descption
     * @return com.xbongbong.pro.config.pojo.vo.CompanyConfigAddBatchVO
     * @throws XbbException
     */
    CompanyConfigAddBatchVO saveBatch(CompanyConfigAddBatchDTO userConfigAddBatchDTO) throws XbbException;

    /**
     * 获取公司的“金额”字段的小数位数
     * @author 吴峰
     * @date 2019/4/5 9:58
     * @param corpid
     * @return java.lang.Integer
     * @throws XbbException 业务异常
     */
    Integer getAmountPrecision(String corpid);

    /**
     * 获取“数字”的小数精度
     * @author 吴峰
     * @date 2019/4/5 10:02
     * @param corpid
     * @return java.lang.Integer
     * @throws XbbException 业务异常
     */
    Integer getNumberPrecision(String corpid);

    /**
     * 获取销售价格是否展示在出库单中
     * @param corpid
     * @return
     */
    Integer getOutstockSalePrice(String corpid);

    /**
     * 超发出库
     * @param corpid
     * @return
     */
    Boolean getOverOutstock(String corpid);

    /**
     * 获取多单位
     * @param corpid
     * @return
     */
    Boolean getMultiUnit(String corpid);
    /**
     * 供应商与产品是否强关联
     * @param corpid
     * @return
     */
    Boolean getPurchaseProductConfig(String corpid);

    CustomerCheckSetConfigGetVO getCustomerCheckSet(BaseDTO companyConfigHasBeenEnableDTO) throws XbbException;

    CustomerCheckRepeatRuleGetVO getCustomerCheckRepeatRule(CustomerCheckRepeatRuleGetDTO customerCheckRepeatRuleGetDTO) throws XbbException;

    /**
     * 获取钉钉待办配置
     * @param baseDTO
     * @return
     */
    CompanyConfigSetWorkrecordVO getDintalkWorkrecordConfig(BaseDTO baseDTO) throws XbbException;

    /**
     * 同步钉钉待办开启/关闭
     * @param companyConfigSetWorkrecordDTO
     * @return
     * @throws XbbException
     */
    CompanyConfigValueSetWorkrecordVO setDintalkWorkrecordConfig(CompanyConfigSetWorkrecordDTO companyConfigSetWorkrecordDTO) throws XbbException;

    /**
     * 同步钉钉待办通用设置
     * @param corpid
     * @param enable 是否开启同步钉钉待办 1是 0否
     * @throws XbbException
     */
    CompanyConfigEntity insertCompanyWorkrecordConfig(String corpid, Integer enable) throws XbbException;
    /**
     * Description:获取公司设置的值
     * @param corpid
     * @param alias
     * @return java.lang.String
     * @author 魏荣杰
     * @date 2019/8/19 15:50
     * @since v4.2.0
     */
    String getCompanyConfigSetValue(String corpid, String alias) throws XbbException;

    /**
     * 创建钉钉待办模板
     * @param processCode
     * @param corpid
     * @author xingxing.xiao
     * @date 2019/09/26 12:45
     */
    String saveDingtalkProcessTemplate(String processCode, String corpid);

    /**
     * 设置价值攻略白名单公司列表，configValue格式为：["1", "2"]
     * @param companyConfigRaidersWhiteDTO
     * @return com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigRaidersWhiteVO
     * @throws XbbException
     * @author zcp
     * @date 19/10/14 014 16:07
     * @update 19/10/14 014 16:07
     * @since v1.0
     * @version v1.0
     */
    CompanyConfigRaidersWhiteVO setRaidersWhite(CompanyConfigRaidersWhiteDTO companyConfigRaidersWhiteDTO) throws XbbException;

    /**
     * 智能助手白名单
     *
     * @param
     * @throws
     * @return
     * @author hongxiao
     * @date 2019-11-19 16:15
     * @since
     * @version
     */
    List<String> getAiAssistantWhite() throws XbbException;

    CompanyConfigJxcConfigVO getJxcConfig(CompanyConfigGetJxcConfigDTO companyConfigGetJxcConfigDTO) throws XbbException;

    JXCSetListVO getJxcConfigList(CompanyConfigGetJxcConfigDTO companyConfigGetJxcConfigDTO) throws XbbException;

    CompanyConfigEnableVO enableJxcConfig(CompanyConfigEnableDTO companyConfigEnableDTO) throws XbbException;


    /**
     * 设置黑名单：数据量过大的公司
     * @param blacklistBigDataCorpDTO
     * @return com.xbongbong.pro.script.pojo.vo.ScriptVO
     * @throws XbbException
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    ScriptVO setBlacklistBigDataCorpList(BlacklistBigDataCorpDTO blacklistBigDataCorpDTO) throws XbbException;

    /**
     * 阿里云呼叫中心保存公司配置
     *
     * @param companyConfigAddDTO 公司配置
     * @return 影响行数
     * @throws XbbException 异常
     */
    Integer aliyunCallcentersave(CompanyConfigAddDTO companyConfigAddDTO) throws XbbException;

    /**
     * 查询公司配置
     *
     * @param findDTO 查询类
     * @return 公司配置
     * @throws XbbException 异常
     */
    CompanyConfigFindVO findCompanyConfig(CompanyConfigFindDTO findDTO) throws XbbException;

    /**
     * 数据预警业务接口最近触发时间
     * @return
     * @throws XbbException
     */
    long  getDwTriggerTime() throws XbbException;

    /**
     * 获取业绩目标离职人员展示设置
     * @param companyConfigGetPerformanceLeaveDTO
     * @return com.xbongbong.pro.companyconfig.pojo.vo.CompanyConfigGetPerformanceLeaveVO
     * @throws XbbException
     * @author xinpeng.jiang
     * @date 2021/8/27 9:14
     * @version 1.0
     */
    CompanyConfigGetPerformanceLeaveVO getPerformanceLeave(CompanyConfigGetPerformanceLeaveDTO companyConfigGetPerformanceLeaveDTO) throws XbbException;

    CompanyConfigFindVO findCompanyConfigByRedis(CompanyConfigFindDTO findDTO);

}
